import java.time.*;
import java.util.*;
import java.util.stream.Collectors;
import java.io.*;
class Administractor extends User {
    public Administractor(String userId, String username, String password, String phone) {
        super(userId, username, password, phone, "管理员");
    }

    @Override
    public void showMenu(Logger logger, CinemaSystem system) {
        Scanner scanner = new Scanner(System.in);
        while (true) {
            System.out.println("\n====管理员菜单====");
            System.out.println("1.修改自身密码");
            System.out.println("2.重置用户密码");
            System.out.println("3.添加用户");
            System.out.println("4.删除用户");
            System.out.println("5.列出所有用户");
            System.out.println("6.查询用户");
            System.out.println("7.修改用户信息");
            System.out.println("8.退出登录");
            System.out.println("请选择操作");

            int choice = scanner.nextInt();
            scanner.nextLine();

            switch (choice) {
                case 1:
                    System.out.println("请输入密码：");
                    String newPassword = scanner.nextLine();
                    this.changePassword(newPassword, logger);
                    break;
                case 2:
                    System.out.println("请输入要重置密码的用户名：");
                    String username = scanner.nextLine();
                    system.resetUserPassword(username, logger, this);
                    break;
                case 3:
                    system.addUserByAdmin(logger, this);
                    break;
                case 4:
                    System.out.println("请输入要删除的用户名：");
                    String delUsername = scanner.nextLine();
                    system.deleteUser(delUsername, logger, this);
                    break;
                case 5:
                    system.listAllUsers();
                    break;
                case 6:
                    System.out.print("输入要查询的用户ID或用户名：");
                    String query = scanner.nextLine();
                    system.queryUser(query);
                    break;
                case 7:
                    System.out.print("请输入要修改的用户名：");
                    String modUsername = scanner.nextLine();
                    system.modifyUserInfo(modUsername, logger, this);
                    break;
                case 8:
                    this.logout();
                    return;
                default:
                    System.out.println("无效选择");
            }
        }
    }
}
